﻿<div style="padding: 15px; overflow: hidden">
    <form id="ui_paradise_editform" method="post" action="">

        <div title="骨灰堂信息" style="padding: 10px">
            <table>
                <tr>
                    <th rowspan="6" style="text-align: center">骨灰堂图片<br />
                        (小于1M):</th>
                    <td rowspan="6">
                        <div style="width: 120px; height: 120px; border: solid 1px gray">
                            <img id="ui_paradise_pic_img" alt="骨灰堂图片" src="/admin/images/paradise.jpg" style="width: 120px; height: 120px;" />
                        </div>
                        <input type="hidden" value="/admin/images/paradise.jpg" id="ui_paradise_pic" name="ui_paradise_pic" />
                        <br />
                        <input type="file" name="ui_upload_photo_file" id="ui_upload_photo_file" onchange="uploadImage()" />
                    </td>
                    <th>所属地区:</th>
                    <td>
                        <input class="easyui-combotree" id="ui_paradise_areaId" name="ui_paradise_areaId"   />
                    </td>
                </tr>
                <tr>
                    
                    <th>骨灰堂序号:
                        <input type="hidden" name="ui_paradise_id" id="ui_paradise_id" />                        
                    </th>
                    <td>
                        <input class="easyui-numberspinner" type="text" name="ui_paradise_num" id="ui_paradise_num" value="1" data-options="min:1,max:9,required:true"  />
                    </td>                
                </tr>
                <tr>
                    
                    <th>类型:                        
                    </th>
                    <td>
                         <select class="easyui-combobox" name="ui_paradise_type" id="ui_paradise_type" data-options="panelHeight:120,editable:false">
                            <option value="骨灰堂">骨灰堂</option>
                            <option value="公墓">公墓</option>
                             <option value="塔园">塔园</option>
                             <option value="埋葬地">埋葬地</option>                             
                            <option value="其他">其他</option>
                        </select>
                    </td>
                
                </tr>
                <tr>
                    <th>名称:</th>
                    <td>
                        <input class="easyui-textbox" type="text" name="ui_paradise_name" id="ui_paradise_name" data-options="required:true" /></td>

                </tr>
                <tr>
                    <th>全名:</th>
                    <td>
                        <input class="easyui-textbox" id="ui_paradise_fullName" name="ui_paradise_fullName" data-options="required:false" />
                    </td>

                </tr>                                                            
            </table>
        </div>
    </form>
    <script>        
        $('#ui_paradise_areaId').combotree({
            url: 'ashx/bg_area.ashx?action=getall',
            required: true,
            line: true,
            //onSelect: function (rec) {
            //    $('#ui_paradise_code').textbox('setValue', rec.scode);
            //}
        });
        function uploadImage() {
            var v = $("#ui_upload_photo_file").val();
            //判断是否选择图片  
            if (v == null || v == "") {
                $.messager.alert('提示', '请选择图片!');
                $("#ui_upload_photo_file").focus();
                return;
            }
            var options = {
                type: "POST",
                url: 'ashx/upload_image.ashx',
                success: function (data) {
                    var res = eval('(' + data + ')');    //转成json格式
                    if (res.success) {
                        $('#ui_paradise_pic_img').attr('src', res.content);
                        $('#ui_paradise_pic').val(res.content);
                    } else {
                        $.messager.alert('提示', res.content);
                    }
                }
            };
            // 将options传给ajaxForm  
            $('#ui_paradise_editform').ajaxSubmit(options);
        }
    </script>
</div>
